package com.zgjkhis.modules.charges.service;

import com.zgjkhis.common.service.BaseService;
import com.zgjkhis.domain.PageResult;
import com.zgjkhis.modules.charges.domain.PrescriptionOrder;
import com.zgjkhis.modules.charges.service.dto.PrescriptionOrderDto;
import com.zgjkhis.modules.charges.service.dto.PrescriptionQueryCriteria;
import com.zgjkhis.modules.charges.service.dto.PrescriptionRefundCriteria;
import com.zgjkhis.modules.outpatient.dto.LocalOrderDto;
import com.zgjkhis.modules.outpatient.dto.RefundComfireDto;
import com.zgjkhis.modules.outpatient.dto.ReissueDto;
import com.zgjkhis.modules.outpatient.service.dto.OrderDto;
import com.zgjkhis.modules.system.domain.Info;
import com.zgjkhis.modules.valid.ValidList;
import org.springframework.data.domain.Pageable;

import java.util.List;

/**
 * @Author yxl
 * @Description 处方
 * @Date 2021/7/13
 **/
public interface PrescriptionService extends BaseService<PrescriptionOrder> {

    /**
     * 分页查询处方单
     * @param criteria
     * @param pageable
     * @return
     */
    PageResult<PrescriptionOrderDto> findAllByPageable(PrescriptionQueryCriteria criteria, Pageable pageable);

    /**
     * 分页查询本地处方单
     * @param criteria
     * @param pageable
     * @return
     */
    PageResult<LocalOrderDto> findAllByPageableForLocal(PrescriptionQueryCriteria criteria, Pageable pageable);

    /**
     * @Author yzq
     * @Description 确认订单
     * @Date 2021/7/14 10:10
     * @Param [order]
     * @return void
     **/
    void confirmOrder(PrescriptionOrder order);

    /**
     * @Author yzq
     * @Description 退款
     * @Date 2021/7/14 14:14
     * @Param [prescriptionRefundCriteria]
     * @return void
     **/
    void refund(ValidList<PrescriptionRefundCriteria> prescriptionRefundCriteria, String msg, String orderNo);

    /**
     * @Author yzq
     * @Description 开处方
     * @Date 2021/9/8 17:02
     * @Param [orderDto]
     * @return void
     **/
    void saveOrder(OrderDto orderDto);

    /**
     * @Author yzq
     * @Description //TODO
     * @Date 2021/9/9 14:22
     * @Param [orderNo, Type]
     * @return void
     **/
    void updateOrderForMoney(String orderNo,Integer type);

    /**
     * 查询待审方数
     * @param pharmacyId
     * @param prescriptionType
     * @return
     */
    int waitCheck(String pharmacyId, Integer prescriptionType);

    /**
     * 待退费数量
     * @param pharmacyId
     * @param prescriptionType
     * @return
     */
    int waitRefund(String pharmacyId, Integer prescriptionType);

    /**
     * 根据物流业务单号更改订单状态
     * @param bspOrderNo
     */
    void updateOrderCondition(String bspOrderNo);

    /**
     * 根据物流业务单号，查询所有订单
     * @param bspOrderNo
     * @return
     */
    List<PrescriptionOrder> queryListByBspOrderNo(String bspOrderNo);

    /**
     * 确认退款操作
     * @param order
     * @param refundComfireDto
     */
    void comfireStock(PrescriptionOrder order, RefundComfireDto refundComfireDto);

    /**
     * 补发订单
     * @param info
     * @param reissueDto
     */
    void reissue(Info info, ReissueDto reissueDto);
    /**
     * 待打印数量
     * @param pharmacyId
     * @param prescriptionType
     * @return
     */
    int waitPrint(String pharmacyId, Integer prescriptionType);

}
